import React from 'react';
import {BrowserRouter as Router,Route,Link,Switch,Redirect} from 'react-router-dom';
//页面
import ProductList from 'page/product/productList/index.jsx';
import SaveProduct from 'page/product/productList/save.jsx';
import ProductDetail from 'page/product/productList/detail.jsx';
import CategoryList from 'page/product/category/index.jsx';
import SaveCategoryPage from 'page/product/category/saveCategory.jsx';

class ProductRouter extends React.Component{

  render(){
    return(
       <Switch>
           <Route  path="/product/index" component={ProductList}/>
           <Route  path="/product/save" component={SaveProduct}/>
           <Route  path="/product/save/:pid" component={SaveProduct}/>
           <Route  path="/product/detail/:pid" component={ProductDetail}/>
           <Redirect exact  from="/product" to='/product/index'/>
           <Route  path="/category/index" component={CategoryList}/>
           <Route  path="/category/index/:pid" component={CategoryList}/>
           <Route  path="/category/save" component={SaveCategoryPage}/>
        </Switch>
    );
  }
}
export default  ProductRouter;
